import service from "../utils/request"

// 内部Dns
export function InnerDnsListApi(data){
    return service.request({
        url: "/dns",
        method: "get",
        params: data,
    })
}

// 内部Dns
export function InnerDnsAddApi(data){
    return service.request({
        url: "/dns",
        method: "post",
        data: data,
    })
}

// 更新slb数据
export function InnerDnsUpdateApi(id, data){
    return service.request({
        url: "/dns/" + id,
        method: "put",
        data: data
    })
}

// Slb信息list
export function SyncSlbListApi(data){
    return service.request({
        url: "/slb",
        method: "get",
        params: data,
    })
}

// 获取账号下域名列表
export function AliyunDomainListApi(data){
    return service.request({
        url: "/aliyun/domains",
        method: "post",
        data: data,
    })
}

// 获取域名解析列表
export function AliyunDomainResolveApi(data){
    return service.request({
        url: "/aliyun/domain/resolves",
        method: "post",
        data: data,
    })
}

// 阿里云添加域名解析
export function AliyunDomainAddApi(data){
    return service.request({
        url: "/aliyun/resolve/add",
        method: "post",
        data: data, // 请求类型为poss
        // params: data // 请求类型为get
    })
}

// 阿里云添加域名解析
export function AliyunAlterListApi(data){
    return service.request({
        url: "/alter/thresholds",
        method: "get",
        params: data // 请求类型为get
    })
}

// ecs
export function AliyunEcsAddApi(data){
    return service.request({
        url: "/aliyun/ecs/add",
        method: "post",
        data: data, // 请求类型为poss
        // params: data // 请求类型为get
    })
}

export function AliyunEcsListApi(data){
    return service.request({
        url: "/aliyun/ecs",
        method: "get",
        params: data // 请求类型为get
    })
}

export async function AliyunEcsNumberApi(){
    const { data } = await service.get('/aliyun/ecs')
    return Number(data.data.pages.total)
}

// 更新slb数据
export function updateSlbData(id, data){
    return service.request({
        url: "/slb/" + id,
        method: "put",
        data: data
    })
}
export function addSlbData(data){
    return service.request({
        url: "/slb",
        method: "post",
        data
    })
}
export function getSlbData(params){
    return service.request({
        url: "/slb",
        method: "get",
        params // 请求类型为get
    })
}
export function getSlbDataById(params){
    console.log(params.id)
    return service.request({
        url: "/slb/" + params.id,
        method: "get",
    })
}

// host
export function getSShData(params){
    return service.request({
        url: "/host",
        method: "get",
        params // 请求类型为get
    })
}

// file
export function getFileData(id, params){
    return service.request({
        url: "/file/" + id,
        method: "get",
        params // 请求类型为get
    })
}

// group
export function groupAdd(data){
    return service.request({
        url: "/group",
        method: "post",
        data, // 请求类型为 post 时
    })
}

// service
export function serviceAdd(data){
    return service.request({
        url: "/service",
        method: "post",
        data, // 请求类型为 post 时
    })
}

// 更新robot faq数据
export function updateFaqData(id, data){
    return service.request({
        url: "/robot/faq/" + id,
        method: "put",
        data: data
    })
}

export function getFaqData(params){
    return service.request({
        url: "/robot/faq",
        method: "get",
        params // 请求类型为get
    })
}

export function addFaqData(data){
    return service.request({
        url: "/robot/faq",
        method: "post",
        data // 请求类型为get
    })
}
// 更新robot duty数据
export function updateDutyData(id, data){
    return service.request({
        url: "/robot/duty/" + id,
        method: "put",
        data: data
    })
}

export function getDutyData(params){
    return service.request({
        url: "/robot/duty",
        method: "get",
        params // 请求类型为get
    })
}

export function addDutyData(data){
    return service.request({
        url: "/robot/duty",
        method: "post",
        data // 请求类型为get
    })
}

// 更新proxy数据
export function updateProxyData(id, data){
    return service.request({
        url: "/info/proxy/" + id,
        method: "put",
        data: data
    })
}

export function getProxyData(params){
    return service.request({
        url: "/info/proxy",
        method: "get",
        params // 请求类型为get
    })
}

export function addProxyData(data){
    return service.request({
        url: "/info/proxy",
        method: "post",
        data // 请求类型为get
    })
}

// 更新appkey数据
export function updateAppkeyData(id, data){
    return service.request({
        url: "/info/appkey/" + id,
        method: "put",
        data: data
    })
}

export function getAppkeyData(params){
    return service.request({
        url: "/info/appkey",
        method: "get",
        params // 请求类型为get
    })
}

export function addAppkeyData(data){
    return service.request({
        url: "/info/appkey",
        method: "post",
        data // 请求类型为get
    })
}

// 更新command数据
export function updateCommandData(id, data){
    return service.request({
        url: "/info/command/" + id,
        method: "put",
        data: data
    })
}

export function getCommandData(params){
    return service.request({
        url: "/info/command",
        method: "get",
        params // 请求类型为get
    })
}

export function addCommandData(data){
    return service.request({
        url: "/info/command",
        method: "post",
        data // 请求类型为get
    })
}

// TpNode
export function TpNodeListApi(data){
    return service.request({
        url: "/info/topology/node",
        method: "get",
        params: data,
    })
}
export function TpNodeAddApi(data){
    return service.request({
        url: "/info/topology/node",
        method: "post",
        data: data,
    })
}
export function TpNodeUpdateApi(id, data){
    return service.request({
        url: "/info/topology/node/" + id,
        method: "put",
        data: data
    })
}

// 更新后台域名
export function syncDomainData(data){
    return service.request({
        url: "/data/domains",
        method: "post",
        data
    })
}

// post code
export function getPostcodeData(data){
    return service.request({
        url: "/info/postcode",
        method: "get",
        params: data,
    })
}

export function updatePostcodeData(id, data){
    return service.request({
        url: "/info/postcode/" + id,
        method: "put",
        data: data
    })
}

// 发布码禁启用
export function Status(data){
    return service.request({
        url: "/info/postcode/status",
        method: "post",
        data,
    })
}

// 更新slb数据
export function updateDepartment(id, data){
    return service.request({
        url: "/department/" + id,
        method: "put",
        data: data
    })
}
export function departmentAdd(data){
    return service.request({
        url: "/department",
        method: "post",
        data
    })
}
export function getDepartmentDetail(params){
    return service.request({
        url: "/department",
        method: "get",
        params // 请求类型为get
    })
}

//jinkuang
// 更新oss数据
export function updateOssData(id, data){
    return service.request({
        url: "/info/oss/" + id,
        method: "put",
        data: data
    })
}

export function getOssData(params){
    return service.request({
        url: "/info/oss",
        method: "get",
        params // 请求类型为get
    })
}

export function addOssData(data){
    return service.request({
        url: "/info/oss",
        method: "post",
        data // 请求类型为get
    })
}